package demo.DtoToVo;

import java.lang.reflect.InvocationTargetException;
import java.util.*;

/**
 * @author : GuoFei
 * @date : 2019/4/26 17:04
 */
public class TestMain {

    public static void main(String[] args) throws IllegalAccessException, InvocationTargetException, InstantiationException {
        List<UserInfo> userInfos = getUserInfos();
        System.out.println(userInfos);
        System.out.println(userInfos);

//        List<User> users = Transv.trans(User.class, userInfos);
//        users.forEach(System.out::println);

//        UserInfo userInfo = getUserInfo();
//        User user = new User();
//        Trans.transalte(userInfo,user );

//        user.getMessage().forEach(System.out::println);

//        System.out.println(JSON.toJSONString(user));
//        UserInfo userInfo = Trans.trans(UserInfo.class, getUser());
//        System.out.println(JSON.toJSONString(user));
//
    }

    public static List<UserInfo> getUserInfos() {
        List<UserInfo> userInfos = new ArrayList<>();
        userInfos.add(getUserInfo());
        userInfos.add(getUserInfo());
        userInfos.add(getUserInfo());
        return userInfos;
    }

    public static UserInfo getUserInfo() {
        Set<String> messages = new HashSet<>(Arrays.asList("111", "222", "333"));
        ArrayList<Product> products =new ArrayList<>(Arrays.asList(new Product("1hhh", 12), new Product("324", 33)));
        Set<Product> productSet = new HashSet<>(products);
        UserInfo userInfo = new UserInfo(1, "1号", true, Double.valueOf(123), messages,  productSet, new Product("32422", 11));
        return userInfo;
    }

    public static User getUser() {
//        User user = new User("8号", "pass", true);
        return null;
    }


}
